//
// Created by Abstergo on 2024/6/18.
//

#ifndef TBS_CPP_NODEITERATORINL_CUH
#define TBS_CPP_NODEITERATORINL_CUH

template<typename T>
NodeIterator<T>::NodeIterator(NodeIterator::node *b) {
  _b = b;
  _i = b;
}

template<typename T>
bool NodeIterator<T>::equals(const Iterator<LinkNode<T>> &other) const {
  return this->source() == other.source();
}

template<typename T>
tbs::structs::Iterator<LinkNode<T>> &NodeIterator<T>::next() {
  _index++;
  _i = _i->after();

  return *this;
}

template<typename T>
bool NodeIterator<T>::has_next() const {
  return _i != nullptr;
}

template<typename T>
LinkNode<T> &NodeIterator<T>::value() {
  return *_i;
}

template<typename T>
CONST LinkNode<T> &NodeIterator<T>::value() CONST {
  return *_i;
}

template<typename T>
const void *NodeIterator<T>::source() const {
  return (void *)_i;
}

template<typename T>
const size_t NodeIterator<T>::index() const {
  return _index;
}

#endif //TBS_CPP_NODEITERATORINL_CUH